<?php
use common\service\StaticService;
use shopend\assets\ShopAsset;
use common\service\GlobalUrlService;
StaticService::includeAppCssStatic(GlobalUrlService::buildShopStaticUrl('/css/goods/add.css'),ShopAsset::class);
StaticService::includeAppJsStatic(GlobalUrlService::buildShopStaticUrl('/backend/qiniu.min.js'),ShopAsset::class);
StaticService::includeAppJsStatic(GlobalUrlService::buildShopStaticUrl('/backend/goods/add.js'),ShopAsset::class);
?>
<div class="layui-card">
  <div class="layui-card-header">添加商品</div>
  <div class="layui-card-body">
    <div class="add_goods">
      <form class="layui-form">
        <ul class="form_ul">
          <li>
            <span class="title">商品分类</span>
            <div class="layui-inline">
              <div class="layui-input-inline">
                <select lay-verify="required" class="span2 oneclass" data-placeholder="Choose a Category" tabindex="1" name="tree_id" lay-filter="one">
                  <option value="0">请选择主营类目</option>
                  <?php foreach ($trees as $val):?>
                    <option value="<?=$val['id']?>"><?=$val['tree_name']?></option>
                  <?php endforeach;?>
                </select>
              </div>
              <div class="layui-input-inline">
                <select lay-verify="required" class="span2 twoclass" data-placeholder="Choose a Category" tabindex="1" name="tree_id" lay-filter="two"></select>
              </div>
              <div class="layui-input-inline">
                <select class="threeclass" name="three_id"> </select>
              </div>
            </div>
          </li>
          <li>
            <span class="title" class="layui-inline">商品名称</span>
            <div class="item">
              <input type="text" class="layui-input layui-input-inline menu-name" name="goods_name" />
              <span class="menu_name_count">0</span>/45
            </div>
          </li>
          <li class="edit_cover">
            <span class="title">封面图</span>
            <div class="layui-inline">
              <label class="upload_cover" for="pic-card3">
                <span class="layui-btn" >
                  <i class="layui-icon">&#xe67c;</i>上传封面图
                </span>
              </label>
              <input type="file" class="pic-card3" id="pic-card3">
              <input type="hidden" name="list_img" value="" class="hidden-pic3">
              <img src="" class="pic3" />
            </div>

          </li>
          <li>
            <span class="title">商品规格</span>
            <div class="item">
              <div class="controls">
                <div class="size-warpper">
                  <span class="layui-btn layui-inline add-attr" style="font-size: 25px;font-weight: bold;">+</span>
                </div>
                <div class="hide add-attr-warpper">
                  <div class="control-group layer-attr-tit">
                    <label class="layui-inline">规格名称:</label>
                    <div class="controls layui-inline">
                      <input type="text" id="attr_name" name="attr_name" class="layui-input" placeholder="请输入规格名称">
                    </div>
                  </div>
                  <div class="text-align-center">
                    <div>
                      <button type="button" class="layui-btn do">提交</button>
                      <button type="button" class="layui-btn layui-btn-primary cancel">取消</button>
                    </div>
                  </div>
                </div>

                <div class="layui-tab" style="display: none;">
                  <ul class="layui-tab-title attribute-name">
                  </ul>
                  <div class="layui-tab-content attribute-value"></div>
                </div>
                <button class="layui-btn display" type="button">生成属性</button>

                <div class="tab-content end-table">
                  <table class="layui-table">
                    <thead class="thead">
                      <tr style="background-image: -webkit-linear-gradient(top, #ffffff 0%, #f2f2f2 100%)">
                        <th class="width100">原价</th>
                        <th class="width100">折扣价</th>
                        <th class="width100">库存</th>
                        <th class="width100">图片</th>
                      </tr>
                    </thead>
                    <tbody class="tbody">
                      <tr>
                        <td><input class="no_b need layui-input" type="text" name="original_price" placeholder="0.00" value=""></td>
                        <td><input class="no_b need layui-input" type="text" name="discount_price" placeholder="0.00" value=""></td>
                        <td><input class="no_b need layui-input" type="text" placeholder="0" name="inventory[]" value=""></td>
                        <td width="160px;"><input class="no_b1 pic-card pic-card4" type="file" indexs="1"><input type="hidden" name="attrimgval" value="" class="attrimgvalue need  attrList imgindex+(i+1)"></td>
                        <td style="display: none;"><input value="0-0-0" class="need"/></td>
                      </tr>
                    </tbody>
                  </table>
                </div>
              </div>
            </div>
          </li>
          <li>
            <span class="title">属性描述</span>
            <div class="item">
              <dl>
                <dt>
                  <span class="layui-btn add_attr_describe"><i class="layui-icon">&#xe61f;</i>添加属性描述</span>
                </dt>
                <dd class="attr_describe">
                  <div>
                    <span>
                      <input type="text" name="key" class="layui-input" placeholder="属性" />
                      <input type="text" name="val" class="layui-input" placeholder="描述" />
                    </span>
                    <b class="layui-btn del_attr_describe"><i class="layui-icon">&#x1006;</i>删除</b>
                  </div>
                </dd>
              </dl>
            </div>
          </li>
          <li class="yf">
            <span class="title">运费</span>
            <div class="item"><span>统一运费 <input type="text" class="layui-input layui-input-inline" name='freight' /></span></div>
          </li>
          <li>
            <span class="title">商品描述</span>
            <div class="item">
              <textarea name="desc" placeholder="请输入内容" class="layui-textarea" id="introduction"></textarea>
              <p style="text-align: right;"><span class="introduction_count">0</span>/220</p>
            </div>
          </li>
          <li>
            <span class="title">详情图</span>
            <div class="item">
              <div class="show-pic" style="width: 100px;">
                <span class="btn btn-file" style="display: none;">
                  <span class="fileupload-new">请选择图片</span>
                  <input type="file" class="default" id="choosepic">
                  <input type="hidden" name="list_img" value="" class="hidden-pic">
                </span>
                <label for="choosepic"><span class="layui-btn"><i class="layui-icon">&#xe67c;</i>上传图片详情图</span></label>
                <input type="hidden" name="list_img" value="" class="hidden-pic">
              </div>
              <div class="imgs" style="margin-top: 20px;">
                <span>
                  <img src="" />
                </span>
              </div>
            </div>
          </li>
        </ul>
      </form>
      <div class="btns">
        <button class="layui-btn btn-last-googs" id="qued"></i>确定</button>
        <a class="layui-btn layui-btn-primary" href="<?= GlobalUrlService::buildShopUrl('goods/index')?>">取消</a>
      </div>
    </div>
  </div>
  
</div>